#include<iostream>
#include<queue>
#include<cstring>

using namespace std;

const int N=210;

int k[N];
int n,a,b,minn=1e9,res;
bool st[N];
bool vis=false; 

void dfs(int x)
{
	st[x]=1;
	if(x==b)
	{
		minn=min(minn,res);
		return;
	}
	if(x+k[x]<=n)
	{
		if(st[x+k[x]])
		{
			vis=1;
			return;
		}
		st[x+k[x]]=1;
		dfs(x+k[x]);
		res++;
	}
	if(x-k[x]>=1)
	{
		if(st[x-k[x]])
		{
			vis=1;
			return;
		}
		st[x-k[x]]=1;
		dfs(x-k[x]);
		res++;
	}
}

int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++) cin>>k[i];
	dfs(a);
	cout<<res<<endl;
	return 0;
}
